﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ComicsEditor
{
    public class DashedLine : PageObject
    {
        public Point Start;
        public Point End;

        internal static Pen penEven;
        internal static Pen penOdd;

        static DashedLine()
        {
            penEven = new Pen(Color.White);
            penEven.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            penEven.DashPattern = new float[] { 4f, 4f };

            penOdd = new Pen(Color.Black);
            penOdd.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
            penOdd.DashPattern = new float[] { 4f, 4f };
            penOdd.DashOffset = 4f;
        }

        public DashedLine(Page Page, Point Start, Point End) : base(Page)
        {
            this.Start = Start;
            this.End = End;
        }

        public override void Draw(Graphics Graphics)
        {
            Graphics.DrawLine(penEven, Page.Transform(Start), Page.Transform(End));
            Graphics.DrawLine(penOdd, Page.Transform(Start), Page.Transform(End));
        }
    }
}
